package com.example.demo.mapper.sysfile;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.bean.PageRes;
import com.example.demo.bean.sysfile.SysFileCateDO;
import com.example.demo.mapper.BaseMapperX;
import com.example.demo.dto.sysfile.SysFileCatePageReqVO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SysFileCateMapper extends BaseMapperX<SysFileCateDO> {
    default PageRes<SysFileCateDO> selectPage(SysFileCatePageReqVO reqVO) {
        Page<SysFileCateDO> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
        return selectPageCommon(page, new QueryWrapper<SysFileCateDO>()
                .eq(ObjectUtil.isNotNull(reqVO.getType()), "type", reqVO.getType())
        );
    }

    default PageRes<SysFileCateDO> selectNotPage(SysFileCatePageReqVO reqVO) {
        return selectPageCommon(new QueryWrapper<SysFileCateDO>()
                .eq(ObjectUtil.isNotNull(reqVO.getType()), "type", reqVO.getType())
        );
    }
}
